#ifndef _SCENE_CELL_
#define _SCENE_CELL_

#include <deque>
#include <list>
#include "../share/list_link.h"
#include "../share/base.h"
#include "Player.h"
#include "../share/object.h"
#include "../share/timer.h"

class CSceneInstance;

class CSceneCell
{
public:
	CSceneCell( );
	~CSceneCell( );

	void clear( );

	int32_t Init( CSceneInstance& scene, int32_t index, int32_t vision_radius_width, int32_t vision_radius_heigth );

	int32_t cell_index( );
	::common::CRect& cell_rect( );
	
	::common::CListLink< Player >& player_list( ) { return player_list_; }
	::common::CListLink< CEntity >& entity_list( ) { return entity_list_; }

private:
	int32_t cell_index_;			/* 格子索引 */
	::common::CRect cell_rect_;		/* 格子视野 */

	::common::CListLink< Player > player_list_; /** 玩家列表 */
	::common::CListLink< CEntity > entity_list_; /** <npc列表  */
	::common::CListLink< CSceneCell > cell_list_;
};

class CSceneCellMgr
{
public:
	CSceneCellMgr( );
	~CSceneCellMgr( );
	void clear( );

	int Init( CSceneInstance& instance, int32_t cell_size, int32_t vision_radius_width, int32_t vision_radius_heigth );

	CSceneCell* GetSceneCell( int32_t cell_index ) const;

private:
	int32_t		cell_size_;	
	CSceneCell* scene_cell_list_;
};

#endif
